package com.ruoyi.order.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.ShopOrderInfo;
import com.ruoyi.order.mapper.ShopOrderInfoMapper;
import com.ruoyi.order.service.IShopOrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-12-03
 */
@Service
public class ShopOrderInfoServiceImpl implements IShopOrderInfoService 
{
    @Autowired
    private ShopOrderInfoMapper shopOrderInfoMapper;

    /**
     * 用户连表
     */
//    @Override
//    public List<ShopOrderInfo> shopUser(ShopOrderInfo shopOrderInfo)
//    {
//        return shopOrderInfoMapper.shopUser(shopOrderInfo);
//    }

    /**
     * 查询订单
     * 
     * @param orderNo 订单主键
     * @return 订单
     */
    @Override
    public ShopOrderInfo selectShopOrderInfoByOrderNo(String orderNo)
    {
        return shopOrderInfoMapper.selectShopOrderInfoByOrderNo(orderNo);
    }

    /**
     * 查询订单列表
     * 
     * @param shopOrderInfo 订单
     * @return 订单
     */
    @Override
    public List<ShopOrderInfo> selectShopOrderInfoList(ShopOrderInfo shopOrderInfo)
    {
        return shopOrderInfoMapper.selectShopOrderInfoList(shopOrderInfo);
    }

    /**
     * 新增订单
     * 
     * @param shopOrderInfo 订单
     * @return 结果
     */
    @Override
    public int insertShopOrderInfo(ShopOrderInfo shopOrderInfo)
    {
        shopOrderInfo.setCreateTime(DateUtils.getNowDate());
        return shopOrderInfoMapper.insertShopOrderInfo(shopOrderInfo);
    }

    /**
     * 修改订单
     * 
     * @param shopOrderInfo 订单
     * @return 结果
     */
    @Override
    public int updateShopOrderInfo(ShopOrderInfo shopOrderInfo)
    {
        return shopOrderInfoMapper.updateShopOrderInfo(shopOrderInfo);
    }

    /**
     * 批量删除订单
     * 
     * @param orderNos 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteShopOrderInfoByOrderNos(String[] orderNos)
    {
        return shopOrderInfoMapper.deleteShopOrderInfoByOrderNos(orderNos);
    }

    /**
     * 删除订单信息
     * 
     * @param orderNo 订单主键
     * @return 结果
     */
    @Override
    public int deleteShopOrderInfoByOrderNo(String orderNo)
    {
        return shopOrderInfoMapper.deleteShopOrderInfoByOrderNo(orderNo);
    }
}
